package com.majie.conversion;

import com.majie.propertyPlaceholderConfiguer.Student;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.StringUtils;

public class StudentConversionService implements Converter<String, Student> {

	@Override
	public Student convert(String source) {
		System.out.println(source);
		if (StringUtils.hasLength(source)) {
			String[] sources = source.split("#");

			Student student = new Student();
			student.setAge(Integer.parseInt(sources[0]));
			student.setName(sources[1]);

			return student;
		}
		return null;
	}

}